package com.fairylove.test;

import com.fairylove.rpc.api.HelloObject;
import com.fairylove.rpc.api.HelloService;
import com.fairylove.rpc.loadbalancer.RoundRobinLoadBalancer;
import com.fairylove.rpc.transport.netty.client.NettyClient;
import com.fairylove.rpc.transport.socket.RpcClient;
import com.fairylove.rpc.transport.socket.RpcClientProxy;

public class NettyTestClient {
    public static void main(String[] args) {
        RpcClient client = new NettyClient(new RoundRobinLoadBalancer());
        RpcClientProxy rpcClientProxy = new RpcClientProxy(client);
        HelloService helloService = rpcClientProxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "This is a message");
        String res = helloService.hello(object);

        HelloObject object2 = new HelloObject(12, "This is a message");
        String res2 = helloService.hello(object2);
        System.out.println(res2);
    }
}
